/*
ID:luongho3
LANG:C++
TASK:ratios
*/
#include <iostream>
#include <fstream>
using namespace std;
#define MAX 100
ifstream fin("ratios.in");
ofstream fout("ratios.out");
int a[4], b[4], c[4], d[4], r[4], t[4];
int mul, i, j , k, l;
int main() {
    fin >> d[1] >> d[2] >> d[3];
    fin >> a[1] >> a[2] >> a[3];
    fin >> b[1] >> b[2] >> b[3];
    fin >> c[1] >> c[2] >> c[3];
    for (i=0;i<100;++i) {
        for (j=0;j<100;++j) {
            for (k=0;k<100;++k) {
                if (i*i + j*j + k*k == 0) {
                   continue;
                }
                t[1] = i*a[1] + j*b[1] + k*c[1];
                t[2] = i*a[2] + j*b[2] + k*c[2];
                t[3] = i*a[3] + j*b[3] +k*c[3];
                if (d[1] != 0) {
                   r[1] = t[1] % d[1];
                }
                else {
                     r[1] = 0;
                }
                if (d[2] != 0) {
                   r[2] = t[2] % d[2];
                }
                else {
                     r[2] = 0;
                }
                if (d[3] != 0) {
                   r[3] = t[3] % d[3];
                }
                else {
                     r[3] = 0;
                }
                if (r[1] == 0 && r[2] == 0 && r[3] == 0) {
                   if (t[1]*d[2] == d[1]*t[2] &&
                      t[2]*d[3] == d[2]*t[3] &&
                      t[3]*d[1] == d[3]*t[1]) {
                      for (l=1;l<=3;++l) {
                          if (d[l] != 0) {
                             mul = t[l] / d[l];
                             break;
                          }
                      }
                      fout << i << " " << j << " " << k << " " << mul << "\n";
                      return 0;
                   }
                }
            }
        }
    }
    fout << "NONE\n";
    return 0;
}
